package com.mach.platform.api.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.bytebuddy.asm.Advice;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 关注实体类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "attention")
public class Attention implements Serializable {

    private static final long serialVersionUID = 1L;

    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    private Long id;

    /**
     * 小程序openId
     */
    @Column(name = "open_id")
    private String openId;

    /**
     * 关注类型 1：设备组 2：设备
     */
    @Column(name = "attent_type")
    private int attentType;

    /**
     * 关注设备组id(对应IotSpace实体的id)
     */
    @Column(name = "dev_groupId")
    private Long devGroupId;

    /**
     * 关注设备id
     */
    @Column(name = "dev_id")
    private Long devId;

    /**
     * 设备组/设备名称
     */
    @Column(name = "attent_name")
    private String attentName;

    /**
     * 关注程度 1：置顶关注 2：普通关注
     */
    @Column(name = "attent_level")
    private int attentLevel;

    /**
     * 设备所属机组分类名称
     */
    @Column(name = "dev_sortName")
    private String devSortName;

    /**
     * 设备组/设备所属站房名称
     */
    @Column(name = "station_name")
    private String stationName;

    /**
     * 关注时间
     */
    @JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "attent_time")
    private LocalDateTime attentTime;


}
